import 'package:flutter/material.dart';
void main(){
  runApp(MyApp());
}

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      title: 'flutter 导航',
      theme: ThemeData(
        //主题色 蓝色
        primarySwatch: Colors.blue,
      ),
      home: FirstScreen(),
    );
  }
}

class FirstScreen extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('导航页面，使用Navigator'),
      ),
      body: Center(
        child: RaisedButton(
            child: Text('查看商品详情介绍页面2'),
            onPressed: (){
              Navigator.push(context, MaterialPageRoute(builder: (context) => new SecondScreen()));
            }
        ),
      ),
    );
  }
}


class SecondScreen extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('商品详情页内容'),
      ),
      body: Center(
        child: RaisedButton(
            child: Text('返回上一级'),
            onPressed: (){
              Navigator.pop(context);
            }
        ),
      ),
    );
  }
}